﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QDT.Core.Assignments;
using QDT.Core.Deals;
using QDT.Core.Projects;

namespace QDT.Services.Projects
{
    /// <summary>
    /// 项目的还款策略接口，不同的项目类型采用不同的策略
    /// </summary>
    public interface IRepayStrategy {

        /// <summary>
        /// 获得还款计划表（针对借款人）
        /// </summary>
        /// <param name="repayments">还款记录</param>
        /// <returns>还款计划表</returns>
        RepaymentScheme GetRepayTableForProject(IList<DebtorRepayment> repayments);

        /// <summary>
        /// 通过债权获得本债权的回款计划
        /// </summary>
        /// <param name="credit">债权，此债权必须是当前项目的债权</param>
        /// <returns></returns>
        RepaymentScheme GetCreditRepaymenScheme(Credit credit);

        /// <summary>
        /// 通过债权转让获得本债权的回款计划
        /// </summary>
        RepaymentScheme GetAssignmentRepaymenScheme(Assignment assignment);

        /// <summary>
        /// 检查此策略下是否可以债权转让
        /// </summary>
        bool IsAssignment { get; }

        /// <summary>
        /// 通过债权创建债权转让信息对象
        /// </summary>
        /// <param name="credit"></param>
        /// <param name="feeRate">手续费</param>
        /// <param name="discountRate">折让率</param>
        /// <returns></returns>
        Assignment CreateAssignment(Credit credit, double feeRate, double discountRate);

        Assignment CreateAssignment(Credit credit, decimal money, double feeRate, double discountRate, bool isOffline = false);

        /// <summary>
        /// 偿还债权
        /// </summary>
        /// <param name="credit">债权</param>
        /// <param name="stage">期次</param>
        void RepayCredit(Credit credit, int stage);
    }
}
